package com.sci.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sci.entity.Food;
import com.sci.mapper.FoodMapper;
import com.sci.service.FoodService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FoodServiceImpl implements FoodService {
    @Resource
    private FoodMapper foodMapper;
    @Override
    public List<Food> getFoodByBusinessId(String businessId) {
        // 使用QueryWrapper构建查询条件
        QueryWrapper<Food> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("business_id", businessId); // 字段名对应数据库列名
        return foodMapper.selectList(queryWrapper);
    }

    @Override
    public Food getFoodById(Integer foodId) {
        QueryWrapper<Food> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("food_id", foodId);
        return foodMapper.selectOne(queryWrapper);
    }
}
